package com.autcar.training.controller;

import com.autcar.training.service.CountService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @ProjectName: training
 * @Package: com.autcar.training.controller
 * @ClassName: CountController
 * @Author: YHHHH
 * @Description: 统计控制器
 * @Date: 2020/9/2 17:33
 * @Version: 1.0
 */
@RestController
public class CountController  {
    @Resource
    private CountService countService;

    /*
    客户统计
     */
    @GetMapping("/customerCount")
    public Map customerCount(){
        Integer customerCount = countService.customerCount();
        Map<String,Integer> customerMap = new HashMap<>();
        customerMap.put("customerCount",customerCount);
        return customerMap;
    }
    /*
    订单统计
     */
    @GetMapping("/orderCount")
    public Map orderCount(){
        Integer orderCount = countService.orderCount();
        Map<String,Integer> orderMap = new HashMap<>();
        orderMap.put("orderCount",orderCount);
        return orderMap;
    }
    /*
    商品统计
     */
    @GetMapping("/goodsCount")
    public Map goodsCount(){
        Integer customerCount = countService.goodsCount();
        Map<String,Integer> goodsMap = new HashMap<>();
        goodsMap.put("goodsCount",customerCount);
        return goodsMap;
    }
    /*
    工作人员统计
     */
    @GetMapping("/workerCount")
    public Map workerCount(){
        Integer customerCount = countService.workerCount();
        Map<String,Integer> workerMap = new HashMap<>();
        workerMap.put("workerCount",customerCount);
        return workerMap;
    }

}
